home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2006 May / PCpro_2006_05.ISO / files / mobile / fma-2.0-stable-setup.exe / {app} / sframework / plugins / BSPlayer.vbs < prev    next >
Encoding:
Text File  |  2004-09-09  |  3.3 KB  |  135 lines

  1. 'FMA Script Framework Plugin
  2. 'BSPlayer
  3. 'Lets you control BSPlayer
  4.  
  5. 'TODO:
  6. '-Testing
  7.  
  8. Class BSPlayer
  9.     
  10.     Private llist
  11.     Private m_Self
  12.     Private m_BSPlayerZoom
  13.     Private mainMenu
  14.     
  15.     'Some info about the plugin
  16.     Public Property Get SHOWABLE 'Do I have a menu?
  17.         SHOWABLE    = True
  18.     End Property
  19.     Public Property Get TITLE 'What's my name?
  20.         TITLE       = "BSPlayer"
  21.     End Property
  22.     Public Property Get DESCRIPTION 'What's my purpose?
  23.         DESCRIPTION = "Lets you control BSPlayer"
  24.     End Property
  25.     Public Property Get AUTHOR 'Who created me?
  26.         AUTHOR      = "streawkceur (inspired by CarpeDi3m)"
  27.     End Property
  28.     Public Property Get URL 'Were can I be found? Where can you get more information?
  29.         URL = "http://fma.xinium.com/"
  30.     End Property
  31.     
  32.     'Who am I?
  33.     Public Property Let Self (s)
  34.         m_Self = s
  35.         ' Some init stuff here:
  36.         If IsEmpty(Settings(Me, "Title")) or Settings(Me, "Title") = "" Then Settings(Me, "Title") = "BSPlayer"
  37.         If IsEmpty(Settings(Me, "Exe"))   or Settings(Me, "Exe")   = "" Then Settings(Me, "Exe")   = "C:\Program Files\Cyberlink\BSPlayer\BSPlayer.exe"
  38.         m_BSPlayerZoom = 0
  39.         Set mainMenu = New ManagedMenu
  40.     End Property
  41.     Public Property Get Self
  42.         Self = m_Self
  43.     End Property
  44.     
  45.     'Display me. Eventually put a menu on the screen
  46.     Sub Show()
  47.         '--> Init Menu
  48.         Set llist = New LinkedList
  49.         Dim bi
  50.         bi = llist.BackInserter
  51.         If BSPlayerOpen Then
  52.             bi.Item = Array("Play",          Self & ".Play")
  53.             bi.Item = Array("Pause",         Self & ".Pause")
  54.             bi.Item = Array("Stop",          Self & ".Stopp")
  55.             bi.Item = Array("Prev Chapter",  Self & ".PrevChapter")
  56.             bi.Item = Array("Next Chapter",  Self & ".NextChapter")
  57.             bi.Item = Array("Subtitles",     Self & ".SubTitles")
  58.             bi.Item = Array("Fullscreen",    Self & ".Fullscreen")
  59.             bi.Item = Array("Zoom",          Self & ".Zoom")
  60.             bi.Item = Array("Close",         Self & ".Close")
  61.         Else
  62.             bi.Item = Array("Launch",        Self & ".Launch")
  63.         End If
  64.         mainMenu.SetList llist
  65.         
  66.         mainMenu.Title = TITLE
  67.         mainMenu.ShowMenu
  68.     End Sub
  69.     
  70.     Function BSPlayerOpen
  71.         BSPlayerOpen = Shell.AppActivate(Settings(Me, "Title"))
  72.     End Function
  73.     
  74.     Sub Launch
  75.         If Fso.FileExists(Settings(Me, "Exe")) Then
  76.             Shell.Exec Settings(Me, "Exe")
  77.             Util.WaitForAppLoad Settings(Me, "Title"), 10000 'Give BSPlayer max. 10 secs to load
  78.         Else
  79.             Debug.ErrorMsg Self & " - Launch: File not found: " & Settings(Me, "Exe")
  80.         End If
  81.         Show
  82.     End Sub
  83.     
  84.     Sub Close
  85.         If BSPlayerOpen Then
  86.             Shell.SendKeys "%{F4}"
  87.             Util.Sleep 5000 'Give BsPlayer 3secs to close itself
  88.         End If
  89.         Show
  90.     End Sub
  91.     
  92.     Sub Play
  93.         If BSPlayerOpen Then Shell.SendKeys "x"
  94.         am.Update
  95.     End Sub
  96.     
  97.     Sub Pause
  98.         If BSPlayerOpen Then Shell.SendKeys "c"
  99.         am.Update
  100.     End Sub
  101.     
  102.     Sub Stopp
  103.         If BSPlayerOpen Then Shell.SendKeys "v"
  104.         am.Update
  105.     End Sub
  106.     
  107.     Sub PrevChapter
  108.         If BSPlayerOpen Then Shell.SendKeys "z"
  109.         am.Update
  110.     End Sub
  111.     
  112.     Sub NextChapter
  113.         If BSPlayerOpen Then Shell.SendKeys "b"
  114.         am.Update
  115.     End Sub
  116.     
  117.     Sub SubTitles
  118.         If BSPlayerOpen Then Shell.SendKeys "s"
  119.         am.Update
  120.     End Sub
  121.     
  122.     Sub Fullscreen
  123.         If BSPlayerOpen Then Shell.SendKeys "f"
  124.         am.Update
  125.     End Sub
  126.     
  127.     Sub Zoom
  128.       m_BSPlayerZoom = (m_BSPlayerZoom + 1) Mod 3
  129.       If BSPlayerOpen Then Shell.SendKeys (m_BSPlayerZoom + 1)
  130.         am.Update
  131.     End Sub    
  132.     
  133. End Class
  134.  
  135.